import upload from "@/utils/upload";
import request from "@/utils/request";
import { getENVIR } from "@/utils/common";
// 学在杭州接口获取浙里办登录信息
export function getParentsInfo(data) {
  return request({
    url: "/getParentsInfo",
    method: "post",
    data: data,
  });
}
// 查询在线工作室列表
export function getWorkroomOnlineList(data, page) {
  return request({
    url: "/system/workroom/onlineList" + page,
    method: "post",
    data: data,
  });
}
// 查询教师列表
export function getTeacherInworkroom(data) {
  return request({
    url: "/system/workroom/teacherInworkroom/" + data,
    method: "post",
  });
}
// 查询在线教师列表
export function getWorkroomOnlineTeacher(data) {
  return request({
    url: "/system/workroom/onlineTeacher/" + data,
    method: "post",
  });
}
// 查询学生统计信息
export function getMyInfoStudentInfo() {
  return request({
    url: "/system/myInfo/studentInfo",
    method: "get",
  });
}
// 统计未读信息
export function getUnreadInformation() {
  return request({
    url: "/system/myInfo/getUnreadInformation",
    method: "get",
  });
}
// 定时统计未读信息
export function getUnreadTask() {
  return request({
    url: "/system/myInfo/unreadTask",
    method: "get",
  });
}
// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: "/system/user/profile/avatar",
    name: data.name,
    filePath: data.filePath,
  });
}

// 文件上传mp3
export function getCommonUploadsmp3(data) {
  return upload({
    url: "/common/uploadsMP3",
    name: data.name,
    filePath: data.filePath,
  });
}
// 文件上传
export function getCommonUploads(data) {
  return upload({
    url: "/common/uploads",
    name: data.name,
    filePath: data.filePath,
  });
}
// 文件上传
export function getCommonUpload(data) {
  return request({
    url: "/common/upload",
    method: "post",
    name: data.name,
    filePath: data.filePath,
  });
}
// 提问
export function getQuestionsAskQuestion(data) {
  return request({
    url: "/system/questions/askQuestion",
    method: "post",
    data: data,
  });
}
// 追问
export function getQuestioncloselyAskAgain(data) {
  return request({
    url: "/system/questionclosely/askAgain",
    method: "post",
    data: data,
  });
}
// 推荐问题
export function getQuestionbank(data) {
  return request({
    url: "/system/questionbank/recommendQuestionList",
    method: "post",
    data: data,
  });
}
// 推荐问题
export function getQuestionByContent(data) {
  return request({
    url: "/system/questionbank/getQuestionByContent",
    method: "post",
    data: data,
  });
}

// 心理咨询提问
export function getCounselingAsk(data) {
  return request({
    url: "/system/counseling/ask",
    method: "post",
    data: data,
  });
}
// 追心理咨询问
export function getCounselingcloselyAskAgain(data) {
  return request({
    url: "/system/counselingclosely/askAgain",
    method: "post",
    data: data,
  });
}
// 在线心理咨询师
export function getOnlineCounselor() {
  return request({
    url: "/system/user/onlineCounselor",
    method: "get",
  });
}
// 查询全部心理教师列表
export function getUserAllCounselor(data) {
  return request({
    url: "/system/user/allCounselor" + data,
    method: "get",
  });
}
// 查询区县
export function getAreaList(data) {
  return request({
    url: "/system/area/list" + data,
    method: "get",
  });
}
// 查询区县 排序
export function getAreaListOrder(data) {
  return request({
    url: "/system/area/listOrder" + data,
    method: "get",
  });
}

// 推荐视频
export function getyoukelist(data) {
  return request({
    url: "/system/assets/youke_list",
    method: "get",
    data: data,
  });
}
// 推荐视频地址
export function getyoukelink(data) {
  return request({
    url: "/system/assets/youke_link",
    method: "get",
    data: data,
  });
}

// 推荐视频列表
export function gethalllist(data) {
  return request({
    url: "/system/assets/teacher_lecture_hall_list",
    method: "get",
    data: data,
  });
}
// 推荐视频列表
export function gethalllist2(data) {
  return request({
    url: "/system/lecturehall/list",
    method: "get",
    data: data,
  });
}
// 推荐视频地址
export function gethalldetail(data) {
  return request({
    url: "/system/assets/teacher_lecture_hall_detail",
    method: "get",
    data: data,
  });
}
// 在线学段学科
export function getOnlineSubjectAndPeriod(data) {
  return request({
    url: "/system/workroom/onlineSubjectAndPeriod",
    method: "post",
    data: data,
  });
}
// 根据学段查找关联的学科和年级
export function getdictByRemark(data) {
  return request({
    url: "/system/dict/data/dictByRemark",
    method: "get",
    data: data,
  });
}

/**
 * @description 首页名师答疑直播数据
 * @returns
 */
export function getLiveList() {
  return request({
    method: "get",
    url: "/system/live/liveList",
  });
}

/**
 * @description 首页名师答疑直播数据
 * @returns
 */
export function getListOperational() {
  return request({
    method: "get",
    url: "/system/live/listOperational",
  });
}

/**
 * @description 获取直播视频详情
 * @param {string} id
 * @returns
 */
export function getLiveDetail(id) {
  return request({
    method: "get",
    url: `/system/live/getOperational?id=${id}`,
  });
}

/**
 * @description 页面埋点
 * @param {string} id: 页面标识
 * @returns
 */
export function refreshLog(id, operationalId) {
  let url = `/system/live/statistics?type=phone&name=${id}`;
  if (operationalId) url += `&operationalId=${operationalId}`;

  if (window.location.href.indexOf("site=app") > -1) url += `&channelType=app`;

  return request({ method: "get", url });
}
